package org.jeecg.modules.simulator.model.person;

import org.jeecg.modules.simulator.model.person.path.PersonPath;
import org.jeecg.modules.simulator.model.person.path.PersonState;
import lombok.Data;



/**
 * @program: gp2
 * @description:
 * @author: lydms
 * @create: 2024-08-20 15:10
 **/

@Data
public class Person {

    public Person(PersonPath personPath){
        this.personPath=personPath;
    }
    String id;

    Integer countInputWalkTime;
    Integer outOutputWalkTime;
    Integer transferWalkTime;
    PersonPath personPath;
    PersonState personState;

    public void setInStationState(){
        personState=PersonState.inStation;
    }


    public void countDownTransferWalkTime(){
        if(transferWalkTime>0){
            transferWalkTime--;
            return;
        }
        personState=PersonState.waitTrain;
    }

    /**
     * @description: 进站倒计时方法
     *
     * @author:  renzhg
     * @date:  2024/9/10 16:12
     **/
    public void countDownInputWalkTime(){


        if(countInputWalkTime>0){
            countInputWalkTime--;
            return;
        }
        personState=PersonState.waitTrain;
    }

    /**
     * @description: 出站倒计时方法
     *
     * @author:  renzhg
     * @date:  2024/9/10 16:13
     **/
    public void  countDownOutputWalkTime(){
        if(outOutputWalkTime>0){
            outOutputWalkTime--;
            return;
        }
        personState=PersonState.offStation;
    }

    PersonInfo personInfo;




    public String getODStationName(){
        return personPath.getOStationName()+"-"+personPath.getDStationName();
    }



    public String getDStationName(){
        return personPath.getDStationName();
    }

    public String getNextNodeName(String stationName){
        return  personPath.getNextOffNodeStaionStr(stationName);
    }

    public boolean isOffStation(String station){
        return personPath.isOffStation(station);
    }

//    public boolean  getCurrentLineIsUp(String LineId,String stationName){
//       String nextStationName= personPath.getNextOffNodeStaionStr(stationName);
//
//        String lineDirs=stationName+"-"+nextStationName;
//
//
//        return personPath.getCurrentLineIsUp(LineId,stationName);
//    }

    public PersonPath getPersonPath() {
        return personPath;
    }

    public void setPersonPath(PersonPath personPath){
        this.personPath=personPath;
    }
}
